<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="${host_url}/js/app/jquery.min.js"></script>
<link rel="stylesheet" href="${host_url}/css/app/common.css">
<link rel="stylesheet"  href="${host_url}/css/app/dropload.css">
<link rel="stylesheet"  href="${host_url}/css/app/he_he_invite_friend.css">
<script src="${host_url}/js/app/jquery.min.js"></script>
<script src="${host_url}/js/app/dropload.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<title>邀请好友（共邀请了多少）</title>
<script type="text/javascript">
	var friendListItem="";
/* 	var m_os="${os}";
	if(m_os=="wechat"){
		friendListItem="friendListItem.do";
	}else{ */
		friendListItem="friendListItem"; 
/* 	} */
	  document.getElementsByTagName('html')[0].style.fontSize = document.documentElement.clientWidth/50 + 'px';
	  
</script>
<style>


</style>
</head>
<script type="text/javascript">
	function fn_go_friendList(member_id){
		var friend_list_url = $("#friend_list_url").val();
		window.webkit.messageHandlers.ios_open_page.postMessage('WKViewController:::url->'+friend_list_url+'?invited_by='+member_id+':::webTitle->邀请好友:::isRefresh->YES'); 
	}
	 $(function(){
			/*  页数 */
			var page_index_all = 2;/*  全部 */
			
		    /* dropload 加载分页 */
		    loadPagination("listAll",page_index_all,"logAll");
	});	

	function loadPagination(div_id, page_index, ul_id){
		$('#'+div_id).dropload({
	        scrollArea : window,
	        loadDownFn : function(me){
	            $.ajax({
	                type: 'get',
	                url: friendListItem+'?page_index='+page_index+"&invited_by=${membervo.invited_by}",
	                dataType: 'text',
	                beforeSend: function(request) {
	    				request.setRequestHeader("AUTHORIZATION","${token}");
	    				request.setRequestHeader("SECRET","${memberId}");
	    				request.setRequestHeader("OS","${os}");
	    				request.setRequestHeader("PAGE","${page}");
	    			 }, 
	                contentType:"application/x-www-form-urlencoded; charset=UTF-8",
	                success: function(msg){
	                    if($.trim(msg)){
	                		page_index++;
	                    	$("#"+ul_id).append(msg);
	                    	me.resetload();
	                   	/*  如果没有数据 */
	                    } else{
	                        	/*  锁定 */
	                        me.lock();
	                        	/*  无数据 */
	                        me.noData();
		                    	 $("#"+div_id+" .dropload-load").parent().remove();
	                    } 
	                },
		                error: function(xhr, type){
	                    	/*  即使加载出错，也得重置 */
	                    me.resetload();
	                } 
	            });
	        }
	    });
	}  
</script>
<body>
<input type="hidden" id="friend_list_url" value="${friend_list_url}" />
<c:if test="${member != null }">
	<ul class="top-user">
	    <li class="head-portrait"><img width="60" height="60" alt="" src="${member.logo}"/></li>
	    <li class="username">${member.nick_name}</li>
	    <li class="inivte-3 po-r">${member.country}&nbsp;${member.tel_h}</li>
	</ul>
</c:if>
	<c:if test="${memberList.size()>0}">
		<p class="top">共邀请了${total}个好友</p>
		<div class="content"  id="listAll">
		 <ul id="logAll">
			<c:forEach items="${memberList }" var="m">
			  
			       	<c:if test="${'ios'==os}">
		  		  		<li class="clearfix po-r" onclick="fn_go_friendList(${m.member_id})">
		  		  	</c:if>
		  		  	<c:if test="${'android'==os}">
		  		  		<li class="clearfix po-r" onclick="android.startUrl('邀请好友','${friend_list_url}','invited_by->${m.member_id}')">
		  		  	</c:if>
		  		  	<c:if test="${'wechat'==os ||'web'==os}">
	  		  			<li class="clearfix po-r">
	  		  	    </c:if>
			        <p class="leftArea head-portrait"><img alt="" src="${m.logo}"></p>
			        <p class="leftArea information">
			        	<span class="clearfix">
				            <span class="name po-r leftArea" style="max-width:50%;">
				            ${m.nick_name}      
				            </span>
			            <span class="leftArea">（${m.level_name}）</span> 
			            </span>
			            <span class="he-people po-r">Ta邀请了<span class="col">${m.children_num}</span>好友</span> 
			        </p>
			       <p class="po-a arrow">&gt;</p>
	
			    </li>
		    </c:forEach>
		</ul>
		</div>
	</c:if>
	 <c:if test="${memberList.size()==0}">
		<div class="zanwu">
		  	<c:if test="${frist==1}">
			  <span><img src="${host_url}/img/app/zanwu.png"></span>
			 	 <p>您还没有邀请好友,快去邀请好友吧</p>
			</c:if> 
		</div>
	</c:if> 
</body>
</html>